import React, { } from 'react'
import { backgroundObj } from '@/utils/utils'
import Container from '../Container'
import { View, Image, RichText } from '@tarojs/components'
import { formatRichText } from '@/utils/utils'
import './index.scss'

const RichTexts = (props) => {
    const { data = {} } = props
    const { content = '', backgroundColor, backgroundImage, top, bottom, paddingTop, paddingLeft, backgroundType } = data

    const renderBg = () => {
        if (backgroundType !== 'image') {
            return {
                background: backgroundColor
            }
        } else {
            return {
                ...backgroundObj(backgroundImage)
            }
        }
    }

    return <Container {...props}>
        <RichText nodes={formatRichText(content)} className='RichText_box'></RichText>
    </Container>
}
export default RichTexts